#include "QTimerOut.hpp"
#include <QTimer>
#include <QtGui/QMovie>
#include <QtGui/QLabel>
#include <QObject>

QTimerOut::QTimerOut(QObject *parent)
    : QObject(parent),m_Timer(new QTimer(parent))
{
    connect(m_Timer, SIGNAL(timeout()), this, SLOT(onQTimeOut()));
};

void QTimerOut::start(int interval){
    m_Timer->start(interval);
};

void QTimerOut::stop(){
    m_Timer->stop();
}

bool QTimerOut::temp(){
    QMovie *mov = new QMovie(this);
    QString file("file:///accounts/1000/shared/camera/Temp.mp4");

    QLabel *label = new QLabel();
    label->setMovie(mov);
    mov->setFileName(file);
    mov->start();
    label->show();

    QImage img = mov->currentImage();
    return img.save("/accounts/1000/shared/camera/1.jpg");
}

void QTimerOut::onQTimeOut(){
    emit execute();
};
